package jp.aztech.android.kawasakiwelfare;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TextView;

/**
 * Main Activity
 */
public class MainActivity extends Activity {
	private final static String TAG  = "MainActivity";

    /* テロップの表示間隔 10秒 */
	private final static int TELOP_INTERVAL = 10;
	
	/**
	 * === onCreate ===
	 */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
		// タイトルバーを非表示に        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
 		
        setContentView(R.layout.main);

		// 写真 
		TextView textview_photo_title = (TextView) findViewById(R.id.textview_photo_title);                 
        PhotoView photo_view = (PhotoView) findViewById(R.id.photo_view);
    	photo_view.setTextViewTitle( textview_photo_title );
    	photo_view.start();    	

		// いいねボタン
		TextView textview_like_count = (TextView) findViewById(R.id.textview_like_count);           
        LikeView like_view = (LikeView) findViewById(R.id.like_view);
        like_view.setTextViewCount( textview_like_count );
        like_view.start();

		// 天気 
		TextView textview_weather_title = (TextView) findViewById(R.id.textview_weather_title);       
        WeatherView weather_view = (WeatherView) findViewById(R.id.weather_view);
        weather_view.setTextViewTitle( textview_weather_title );
        weather_view.start();

		// テロップ 
        TelopView telop_view = (TelopView) findViewById(R.id.telop_view);
        telop_view.setInterval( TELOP_INTERVAL );
        telop_view.start();
    }

	/**
	 * === onCreateOptionsMenu ===
	 */
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate( R.menu.main_menu, menu );
        return true;
    }

	/**
	 * === onOptionsItemSelected ===
	 */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) 
		{
			// デバック情報
        	case R.id.menu_info:
       			Intent intent = new Intent( this, InfoActivity.class );
				startActivity( intent );  
            	return true;
        }
        return false;
    }
	
}